package org.boot.wxipad.common.error;

import lombok.Getter;

/**
 * @author liyuncong
 * @version 1.0
 * @file WxIpadErrorException
 * @brief 调用微信IPAD接口错误异常
 * @details 调用微信IPAD接口错误异常
 * @date 2024-08-05
 *
 * Edit History
 * ----------------------------------------------------------------------------
 * DATE                     NAME               DESCRIPTION
 * 2024-08-05               liyuncong          Created
 */
@Getter
public class WxIpadErrorException extends Exception {

    private final WxIpadError error;

    private static final int DEFAULT_ERROR_STATUS = -99;

    public WxIpadErrorException(String message) {
        this(WxIpadError.builder().status(DEFAULT_ERROR_STATUS).message(message).build());
    }

    public WxIpadErrorException(WxIpadError error) {
        super(error.toString());
        this.error = error;
    }

    public WxIpadErrorException(Throwable cause) {
        super(cause);
        this.error = null;
    }

    public WxIpadErrorException(WxIpadError error, Throwable cause) {
        super(error.toString(), cause);
        this.error = error;
    }
}
